﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<MethodWorx.CMS.UI.Models.AdministrationSummaryModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	MethodWorx CMS - Administration
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

 <script language="javascript">
        function clearDatabase() {
            if (confirm("Are you sure you want to clear the database?")) {
                MethodWorx.CMS.showPleaseWait();
                $.getJSON("<%=Url.Content("~/System/ClearDatabase")%>", function (obj) {
                    MethodWorx.CMS.hidePleaseWait();
                    if (obj.Success) {
                        alert("The database has been cleared down, you will now be logged out.  You will be required to login as the default user:\r\n\r\nUserename: 'admin'\r\nPassword: 'admin'.");
                        window.parent.location.href = "<%=Url.Content("~/Login")%>";
                    }
                    else
                        alert("An unexepcted error occured:\r\n\r\n" + obj.ErrorMessage);
                },
                function () {
                    MethodWorx.CMS.hidePleaseWait();
                    alert("An unexepcted error occured");
                });
            }
        }
    </script>
    

    <h2>CMS Administration Overview</h2>

    <fieldset>
        <legend>
            Application Settings
        </legend>
        <div class="formItem">
            <label>Application Type:</label>
            <div style="width:250px;float:left;padding-right:10px;"><%=this.Model.ApplicationType %></div>
            <img id="applicationType" style="" src="<%=Url.Content("~/Images/icons/information.png")%>" title="This is how the CMS is configured to be used"/>
        </div>
        <div class="formItem">
            <label>Base URI:</label>
            <div style="width:250px;float:left;padding-right:10px;"><%=this.Model.BaseUri %></div>
            <img id="baseURI" style="" src="<%=Url.Content("~/Images/icons/information.png")%>" title="This is the URL where the live / preview website is hosted"/>
        </div>
        <%=Html.FormButtons(b => 
        {
            b.LinkButton("edit", "Edit these settings", Url.Content("~/System/ApplicationSettings"));
        }) %>
    </fieldset>
    <br />
    <fieldset>
        <legend>Clear Database & Restore Settings</legend>
        <div class="formItem">
            Click the button below to restore the database back to its original deployed state.  This will delete all your data and can only be undone by importing data or restoring the physical database.
        </div>
        <div class="formItem">
            <button onclick="javascript:clearDatabase()">
                Clear Content Database
            </button>
        </div>
    </fieldset>
    
   
</asp:Content>
